import request from '@/utils/request'

export function login(data) {
  return request({
    method: 'post',
    url: '/user/login',
    data
  })
}

export function getInfo(token) {

}

// 注册
export function register(data) {
  return request({
    url: '/user/register',
    method: 'POST',
    data
  })
}

// 获取所有科室
export const getAllDepName = () =>{
  return request({
    url:'department/listAll'
  })
}

// 患者通过id获取挂号记录
export function getRegisteredById(id, state){
  return request({
    method:'GET',
    url:`order/listByPatientId`,
    params:{
      patientId:id,
      state
    }
  })
}

// 获取用户信息
export const getUserInfo = () =>{
  return request({
    url:'user/getUserInfo'
  })
}

// 患者完善个人信息
export function patientInfo(data){
  return request({
    method:'post',
    url:`user/perfectMessage`,
    data
  })
}


// 医生通过id获取挂号记录
export function doctorGetRegisteredById(id, state){
  return request({
    method:'GET',
    url:'order/listByDoctorId',
    params:{
      doctorId:id,
      state
    }
  })
}

// 通过id查询诊室名称
export function getZhenById(id){
  return request({
    method:'get',
    url:'consultationRoom/list',
    params:{
      depId:id
    }
  })
}

// 根据症状获取推荐科室
export function recoDepartment(department){
  return request({
    url:'department/listBySysmptomStr',
    params:{
      sysmptomStr:department
    }
  })
}

// 根据科室id获取推荐医生
export function recoDoctorById(id){
  return request({
    url:'user/listUserByDepId',
    params:{
      depId:id
    }
  })
}

// 根据科室id获取推荐医生
export function registered(data){
  return request({
    method:'post',
    url:'order/add',
    data
  })
}

// 获取所有医生信息
export function getAllDoctor(){
  return request({
    url:'user/getDoctor'
  })
}


// 添加医生
export function addDoctor(data){
  return request({
    url:'user/addDoctor',
    method:'post',
    data
  })
}

// 删除科室
export function delDepartment(id){
        return request({
          method:'delete',
          url:'department/delete',
          params:{
            id:id
          }
        })
}

// 添加科室
export function addDep(data){
  return request({
    method:'post',
    url:'department/add',
    data
  })
}

// 诊室列表
export function allClinic(){
  return request({
    url:'consultationRoom/list'
  })
}

// 删除诊室
export function delClinic(id){
  return request({
    method:'delete',
    url:'consultationRoom/delete',
    params:{
      id:id
    }
  })
}

// 添加诊室
export function addCli(data){
  return request({
    method:'post',
    url:'consultationRoom/add',
    data:{
      definitions:data
    }
  })
}

// 医生修改挂号状态
export function updateOrderState(data){
  return request({
    method:'put',
    url:'order/updateState',
    data
  })
}